package com.oa.xinxi.dao;

import com.oa.xinxi.entity.ZhuanTiWD;
import org.apache.ibatis.jdbc.SQL;

public class ZhuanTiWDSqlProvider {

    public String insertSelective(ZhuanTiWD record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("zhuantiwendang");
        
        if (record.getZtwdId() != null) {
            sql.VALUES("ztwd_id", "#{ztwdId,jdbcType=INTEGER}");
        }
        
        if (record.getTitle() != null) {
            sql.VALUES("title", "#{title,jdbcType=VARCHAR}");
        }
        
        if (record.getUploadWj() != null) {
            sql.VALUES("upload_wj", "#{uploadWj,jdbcType=VARCHAR}");
        }
        
        if (record.getCreator() != null) {
            sql.VALUES("creator", "#{creator,jdbcType=VARCHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.VALUES("createtime", "#{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdator() != null) {
            sql.VALUES("updator", "#{updator,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.VALUES("updatetime", "#{updatetime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getAuthId() != null) {
            sql.VALUES("auth_id", "#{authId,jdbcType=INTEGER}");
        }
        
        if (record.getZtwdContent() != null) {
            sql.VALUES("ztwd_content", "#{ztwdContent,jdbcType=LONGVARCHAR}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(ZhuanTiWD record) {
        SQL sql = new SQL();
        sql.UPDATE("zhuantiwendang");
        
        if (record.getTitle() != null) {
            sql.SET("title = #{title,jdbcType=VARCHAR}");
        }
        
        if (record.getUploadWj() != null) {
            sql.SET("upload_wj = #{uploadWj,jdbcType=VARCHAR}");
        }
        
        if (record.getCreator() != null) {
            sql.SET("creator = #{creator,jdbcType=VARCHAR}");
        }
        
        if (record.getCreatetime() != null) {
            sql.SET("createtime = #{createtime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdator() != null) {
            sql.SET("updator = #{updator,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdatetime() != null) {
            sql.SET("updatetime = #{updatetime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getAuthId() != null) {
            sql.SET("auth_id = #{authId,jdbcType=INTEGER}");
        }
        
        if (record.getZtwdContent() != null) {
            sql.SET("ztwd_content = #{ztwdContent,jdbcType=LONGVARCHAR}");
        }
        
        sql.WHERE("ztwd_id = #{ztwdId,jdbcType=INTEGER}");
        
        return sql.toString();
    }
}